package com.shanyu.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.github.pagehelper.PageInfo;
import com.shanyu.service.IItemCommentService;

@RestController
@RequestMapping(value = "/comment")
public class ItemCommentController {
	
	@Autowired
	private IItemCommentService itemCommentService;
	
	@RequestMapping(value = "/list")
	public PageInfo getCommentList(@RequestParam(required = false) String itemId,
			@RequestParam(defaultValue = "1") int pageNum,
			@RequestParam(defaultValue = "10") int pageSize){
		return itemCommentService.getItemComment(itemId, pageNum, pageSize);
	}

	@RequestMapping(value = "/save")
	public void saveComment(String itemId,String skuId,String content,float score,String memberId,
			String urls){
		itemCommentService.insertItemComment(itemId, skuId, content, memberId, urls, score);
	}
}
